package p6UserAction;

import org.apache.hadoop.io.WritableComparable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class UserBean implements WritableComparable<p3Search.UserBean> {
    private String uid;     //用户ID
    private String iid;     //商品ID
    private String btype;   //动作种类
    private String itype;   //商品种类
    private String time;    //时间

    public UserBean() {
    }

    public UserBean(String uid, String iid, String btype, String itype, String time) {
        this.uid = uid;
        this.iid = iid;
        this.btype = btype;
        this.itype = itype;
        this.time = time;
    }


    @Override
    public int compareTo(p3Search.UserBean o) {
        return 1;
    }

    @Override
    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeChars(uid+',');
        dataOutput.writeChars(iid+',');
        dataOutput.writeChars(btype+',');
        dataOutput.writeChars(itype+',');
        dataOutput.writeChars(time);
    }

    @Override
    public void readFields(DataInput dataInput) throws IOException {
        String ss;
        ss=dataInput.readLine();
        String[] fields=ss.split(",");
        uid=fields[0];
        iid=fields[1];
        btype=fields[2];
        itype=fields[3];
        time=fields[4];
    }

    @Override
    public String toString() {
        return  uid+","+iid+","+btype+","+itype+","+time;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getIid() {
        return iid;
    }

    public void setIid(String iid) {
        this.iid = iid;
    }

    public String getBtype() {
        return btype;
    }

    public void setBtype(String btype) {
        this.btype = btype;
    }

    public String getItype() {
        return itype;
    }

    public void setItype(String itype) {
        this.itype = itype;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }
}

